package com.yanqingying.mapper;

import com.yanqingying.Emp;
import com.yanqingying.EmpQueryParam;
import com.yanqingying.LoginInfo;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface EmpMapper {
    /**
     * 查询所有的员工及其对应的部门名称
     */

    List<Emp> list(EmpQueryParam param);
    @Options(useGeneratedKeys = true,keyProperty = "id")
    @Insert("insert into emp(username,password,name, gender, phone, job, salary, image, entry_date, dept_id, create_time, update_time) values (#{username},#{password},#{name},#{gender},#{phone},#{job},#\n" +
            " #{salary},#{image},#{entryDate},#{deptId},#{createTime},#{updateTime})")
    void add(Emp emp);

    void delete(List<Integer> ids);


    Emp getsId(Integer id);

    void upLoad(Emp id);

    @MapKey("name")
    List<Map> empGenderData();

    @MapKey("pos")
    List<Map> empJobData();

    @Select("select * from emp where username = #{username} and \n" +
            "password = #{password} ")
    LoginInfo login(Emp emp);
}

